<template>

    <van-nav-bar title="标题" left-text="返回" right-text="按钮" left-arrow @click-left="onClickLeft"
        @click-right="onClickRight">

        <template #right>
            <van-icon name="star-o" size="18" />
        </template>
    </van-nav-bar>


</template>

<script >
import { NavBar } from 'vant';
import { Icon } from 'vant';
import { Dialog } from 'vant';
import {useRouter} from 'vue-router'
export default {
    name: 'exercises',
    components: {
        [NavBar.name]: NavBar,
        [Icon.name]: Icon,
        [Dialog.Component.name]: Dialog.Component,
    },

    setup() {
          //跳转到首页
        const router = useRouter();
        
        const onClickLeft = function() {
            Dialog.confirm({
                title: '标题',
                message:
                    '如果解决方法是丑陋的，那就肯定还有更好的解决方法，只是还没有发现而已。',
            }).then(() => {
                 
                    router.push('/')
                   

                })
                .catch(() => {
                    // on cancel
                });
            
        }
        return {
            onClickLeft,
         
        };
    },
};

</script>


<style scoped lang ="less">
.main {
    &-swipeImage {
        width: 100%;
        height: 53vw;
        display: block;
    }

}
</style>